{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "fb4ec3f1",
   "metadata": {},
   "source": [
    "# Python进阶-ML模型应用6_Logistic Regression逻辑回归应用\n",
    "\n",
    "\n",
    "\n",
    "逻辑回归（Logistic Regression）是一种广义的线性回归分析模型，同时也属于机器学习中的监督学习。尽管其名称中含有\"回归\"二字，实际上它主要被用于解决二分类问题，例如预测客户是否会购买某个商品，借款人是否会违约等等。此外，逻辑回归也可以应用于多分类问题。\n",
    "\n",
    "在处理这类问题时，逻辑回归会估计某种事物的可能性，例如某用户购买某商品的可能性，某病人患有某种疾病的可能性，以及某广告被用户点击的可能性等。但需要注意的是，这里提到的是“可能性”，而非数学上的“概率”，因此逻辑回归的结果并非数学定义的概率值。"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "f41666ce",
   "metadata": {},
   "source": [
    "## 应用案例（一）"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "85233069",
   "metadata": {},
   "source": [
    "### 1、导入函数库"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "209a3a34",
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import pandas as pd\n",
    "import matplotlib.pyplot as plt\n",
    " \n",
    "from sklearn.linear_model import LogisticRegression#逻辑回归函数\n",
    "from sklearn.model_selection import train_test_split#切分数据集（训、测）\n",
    "from sklearn.metrics import confusion_matrix#混淆矩阵"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "d9668c11",
   "metadata": {},
   "source": [
    "### 2、加载数据集"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "0e533d9a",
   "metadata": {},
   "outputs": [],
   "source": [
    "#二分类数据——证明是否有糖尿病 \n",
    "data=pd.read_csv('./kaggle-data/diabetes.csv')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "8d02137d",
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Pregnancies</th>\n",
       "      <th>Glucose</th>\n",
       "      <th>BloodPressure</th>\n",
       "      <th>SkinThickness</th>\n",
       "      <th>Insulin</th>\n",
       "      <th>BMI</th>\n",
       "      <th>DiabetesPedigreeFunction</th>\n",
       "      <th>Age</th>\n",
       "      <th>Outcome</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>6</td>\n",
       "      <td>148</td>\n",
       "      <td>72</td>\n",
       "      <td>35</td>\n",
       "      <td>0</td>\n",
       "      <td>33.6</td>\n",
       "      <td>0.627</td>\n",
       "      <td>50</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1</td>\n",
       "      <td>85</td>\n",
       "      <td>66</td>\n",
       "      <td>29</td>\n",
       "      <td>0</td>\n",
       "      <td>26.6</td>\n",
       "      <td>0.351</td>\n",
       "      <td>31</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>8</td>\n",
       "      <td>183</td>\n",
       "      <td>64</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>23.3</td>\n",
       "      <td>0.672</td>\n",
       "      <td>32</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1</td>\n",
       "      <td>89</td>\n",
       "      <td>66</td>\n",
       "      <td>23</td>\n",
       "      <td>94</td>\n",
       "      <td>28.1</td>\n",
       "      <td>0.167</td>\n",
       "      <td>21</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>0</td>\n",
       "      <td>137</td>\n",
       "      <td>40</td>\n",
       "      <td>35</td>\n",
       "      <td>168</td>\n",
       "      <td>43.1</td>\n",
       "      <td>2.288</td>\n",
       "      <td>33</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>763</th>\n",
       "      <td>10</td>\n",
       "      <td>101</td>\n",
       "      <td>76</td>\n",
       "      <td>48</td>\n",
       "      <td>180</td>\n",
       "      <td>32.9</td>\n",
       "      <td>0.171</td>\n",
       "      <td>63</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>764</th>\n",
       "      <td>2</td>\n",
       "      <td>122</td>\n",
       "      <td>70</td>\n",
       "      <td>27</td>\n",
       "      <td>0</td>\n",
       "      <td>36.8</td>\n",
       "      <td>0.340</td>\n",
       "      <td>27</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>765</th>\n",
       "      <td>5</td>\n",
       "      <td>121</td>\n",
       "      <td>72</td>\n",
       "      <td>23</td>\n",
       "      <td>112</td>\n",
       "      <td>26.2</td>\n",
       "      <td>0.245</td>\n",
       "      <td>30</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>766</th>\n",
       "      <td>1</td>\n",
       "      <td>126</td>\n",
       "      <td>60</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>30.1</td>\n",
       "      <td>0.349</td>\n",
       "      <td>47</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>767</th>\n",
       "      <td>1</td>\n",
       "      <td>93</td>\n",
       "      <td>70</td>\n",
       "      <td>31</td>\n",
       "      <td>0</td>\n",
       "      <td>30.4</td>\n",
       "      <td>0.315</td>\n",
       "      <td>23</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>768 rows × 9 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "     Pregnancies  Glucose  BloodPressure  SkinThickness  Insulin   BMI  \\\n",
       "0              6      148             72             35        0  33.6   \n",
       "1              1       85             66             29        0  26.6   \n",
       "2              8      183             64              0        0  23.3   \n",
       "3              1       89             66             23       94  28.1   \n",
       "4              0      137             40             35      168  43.1   \n",
       "..           ...      ...            ...            ...      ...   ...   \n",
       "763           10      101             76             48      180  32.9   \n",
       "764            2      122             70             27        0  36.8   \n",
       "765            5      121             72             23      112  26.2   \n",
       "766            1      126             60              0        0  30.1   \n",
       "767            1       93             70             31        0  30.4   \n",
       "\n",
       "     DiabetesPedigreeFunction  Age  Outcome  \n",
       "0                       0.627   50        1  \n",
       "1                       0.351   31        0  \n",
       "2                       0.672   32        1  \n",
       "3                       0.167   21        0  \n",
       "4                       2.288   33        1  \n",
       "..                        ...  ...      ...  \n",
       "763                     0.171   63        0  \n",
       "764                     0.340   27        0  \n",
       "765                     0.245   30        0  \n",
       "766                     0.349   47        1  \n",
       "767                     0.315   23        0  \n",
       "\n",
       "[768 rows x 9 columns]"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "877f361b",
   "metadata": {},
   "source": [
    "### 3、划分数据集为X，y"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "6d88519a",
   "metadata": {},
   "outputs": [],
   "source": [
    "X=data.iloc[:,:-1]#特征集\n",
    " \n",
    "y=data.iloc[:,-1]#响应集"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "05e44cfb",
   "metadata": {},
   "source": [
    "### 4、绘制二分类图像"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "9789733b",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXMAAAEGCAYAAACXVXXgAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/MnkTPAAAACXBIWXMAAAsTAAALEwEAmpwYAAAbmUlEQVR4nO3de5xdZX3v8c93JiSEBAmBMSEKRCIXAculwyUIMvgCqj1qLLXIUUC8lKoc7dHjoeqhL6lNbzlK5VBQo4lWwVqUQsCKhqaGiw20STEqCNFoANGBQICQ1ASZ+Z0/njXMzp59WTOzd2bmme/79cora9Z61rOe/Zu9v3vNs9feWxGBmZlNbB1jPQAzMxs9h7mZWQYc5mZmGXCYm5llwGFuZpYBh7nZMEnSWI/BrJrD3CYVSUcU/79Y0hsbtDtA0oeK5RMk3VYsHwPcslsGazYM2Ya5pMslXd6Cfq6U9Jbx0s9EIektkq4co2NPqXX2LOlo4A5JewE7gaskHVCnmx3AeySdB/wG2CmpA7gS+GaJMVwk6deSeiU9IuljVds/LOnDw7xpu52kHkmr29j/KZL+qcb6/STdKekxSTdVrD9Q0n+0cTxt7b+dpoz1AMa7iPjjsm0lzQIuiohPj6afHETEPwL/2I6+JU0DtgPPAf1VmzuBPYGXAZuqtv0Z8BcR8V9FP1cCyyW9PiL6KvqfCmwFzgfeDjxQbHo5sAX4XNHm+YioPn6lFRFxnqQXAd+X9M2I+AFARHxymDc7SxHxb8A5NTadD2yIiNMk7VfR/hHghNEeV9KbgE0R8f2q8bSk/7GQ7Zn5GJkF/M8xHsNk8BxwEHAwML/q30HAgcAvKneQdC5wBHBNxeorganAVyXtUbH+s8A9wBWkB/a9wCnAPwBzgDuB7xX9NRURW4EfAK8oefsM9gUe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3MMuAwNzPLgMPczCwDDnMzswz8f/eDZSy19YMvAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.rcParams['font.sans-serif']=['SimHei'] #用来正常显示中文\n",
    "plt.rcParams['axes.unicode_minus']=False #用来正常显示负号\n",
    " \n",
    "plt.plot(X,y,'o')\n",
    "plt.title('logistic regression 二分类 Binary classification') #二分类 Binary classification\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "f0b139d4",
   "metadata": {},
   "source": [
    "### 5、切分数据集为——trian、test集"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "id": "420e7bee",
   "metadata": {},
   "outputs": [],
   "source": [
    "X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.3, random_state=0)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "24ef8bb4",
   "metadata": {},
   "source": [
    "### 6、创建逻辑回归模型并训练"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "id": "a23843eb",
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\ProgramData\\Anaconda3\\lib\\site-packages\\sklearn\\linear_model\\_logistic.py:763: ConvergenceWarning: lbfgs failed to converge (status=1):\n",
      "STOP: TOTAL NO. of ITERATIONS REACHED LIMIT.\n",
      "\n",
      "Increase the number of iterations (max_iter) or scale the data as shown in:\n",
      "    https://scikit-learn.org/stable/modules/preprocessing.html\n",
      "Please also refer to the documentation for alternative solver options:\n",
      "    https://scikit-learn.org/stable/modules/linear_model.html#logistic-regression\n",
      "  n_iter_i = _check_optimize_result(\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "LogisticRegression()"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "logregression=LogisticRegression()\n",
    "\n",
    "logregression.fit(X_train,y_train)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "id": "95bce46b",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "LogisticRegression(max_iter=10000)"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#Increase the number of iterations (max_iter) or scale the data\n",
    "LogisticRegression(C=1.0, class_weight=None, dual=False, fit_intercept=True,\n",
    "                   intercept_scaling=1, l1_ratio=None, max_iter=10000,\n",
    "                   multi_class='auto', n_jobs=None, penalty='l2',\n",
    "                   random_state=None, solver='lbfgs', tol=0.0001, verbose=0,\n",
    "                   warm_start=False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "id": "a3c3bb38",
   "metadata": {},
   "outputs": [],
   "source": [
    "y_predict=logregression.predict(X_test)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "id": "f781f116",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Accuracy of logistic regression classifier on diabetes: 0.779\n"
     ]
    }
   ],
   "source": [
    "print('Accuracy of logistic regression classifier on diabetes: {:.3f}'.format(logregression.score(X_test, y_test)))"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "fe6964e3",
   "metadata": {},
   "source": [
    "准确率（Accuracy）是一个主要的分类任务评估指标，它衡量的是预测正确的样本数量占总样本数量的比例。更具体来说，如果你有n个样本，其中真正例（TP）、真反例（TN）、假正例（FP）和假反例（FN）分别为a、b、c和d，那么准确率的计算公式就是 (a+d)/(a+b+c+d)。\n",
    "\n",
    "然而，需要注意的是，准确率并不是所有情况下都适用的评价指标。例如，在类别严重不平衡的情况下，即使模型将所有样本都预测为多数类别，其准确率也可能会非常高。因此，在这种情况下，我们可能需要结合其他指标如精确率（Precision）、召回率（Recall）或F1 Score等来进行更全面的评估。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "665c764f",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "id": "0d5bf8cd",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.7792207792207793"
      ]
     },
     "execution_count": 25,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "logregression.score(X_test, y_test) #(141+39)/(141+39+16+35)=180/231"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "id": "7517930e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[141,  16],\n",
       "       [ 35,  39]], dtype=int64)"
      ]
     },
     "execution_count": 27,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#混淆矩阵\n",
    "confusion_matrix(y_test,y_predict)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "efde971d",
   "metadata": {},
   "source": [
    "混淆矩阵，也被称为可能性矩阵或错误矩阵，是机器学习中用于评估分类模型预测结果的重要工具。它以矩阵的形式，根据真实的类别与分类模型预测的类别，对数据集中的记录进行汇总。\n",
    "\n",
    "在具体形式上，混淆矩阵通常为一个方阵，其大小为（真实值，预测值）或者（预测值，真实值）。这样的布局可以帮助我们更清晰地看出预测集与真实集中混合的一部分。在这个矩阵中，每一行代表实际类别，每一列代表预测类别。而矩阵的每个单元格则包含了在该实际类别和预测类别下的样本数量。\n",
    "\n",
    "通过混淆矩阵，我们可以计算出诸如准确度、精确度和召回率等评估指标，全面地了解模型在不同类别上的性能。此外，在某些应用场景中（如医疗诊断、欺诈检测等），不同类型的错误（False Positives 和 False Negatives）可能具有不同的成本或严重性。此时，混淆矩阵就可以帮助我们更细致地评估这些成本。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "id": "6bcbf26f",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "              precision    recall  f1-score   support\n",
      "\n",
      "           0       0.80      0.90      0.85       157\n",
      "           1       0.71      0.53      0.60        74\n",
      "\n",
      "    accuracy                           0.78       231\n",
      "   macro avg       0.76      0.71      0.73       231\n",
      "weighted avg       0.77      0.78      0.77       231\n",
      "\n"
     ]
    }
   ],
   "source": [
    "#输出混淆矩阵的计算值\n",
    "from sklearn.metrics import classification_report\n",
    " \n",
    "print(classification_report(y_test, y_predict))  \n",
    " \n",
    "#precision=141/(141+35) 39/(39+16)\n",
    "#recall=141/(141+16) 39/(35+39)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "id": "7aefae47",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[ 0.08528142  0.03447238 -0.01082115  0.00636555 -0.0013322   0.08852989\n",
      "   0.73271533  0.02415024]]\n"
     ]
    }
   ],
   "source": [
    "print(logregression.coef_)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "id": "76730ccc",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[-8.605395]\n"
     ]
    }
   ],
   "source": [
    "print(logregression.intercept_)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "id": "5982f9a8",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAX8AAAERCAYAAACTuqdNAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/MnkTPAAAACXBIWXMAAAsTAAALEwEAmpwYAAAypklEQVR4nO3debxN9frA8c+TIfNQiai4ul0hIZLxOBGla7gN4pLpJumW0qBLE5WkbjRwE9eQUt1KRTOVn0JUxkwNiiRjRRxDhvP8/viucxynPZ1j7732Pvt5v17nZa+9v3utZ+3jPOd7vuu7nq+oKsYYY1LLCX4HYIwxJv4s+RtjTAqy5G+MMSnIkr8xxqQgS/7GGJOCLPkbY0wKsuSfhERkmIhkiMh2EflJRG6P0XGeFJEusdh3MhGRO0TkjjgeL11E5sbreLEiIk1F5PVE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BG2TVbir1evXp7fG8iYMWNo3rw5ffr04cMPP6Rdu3b52k80VKpUicGDB0d1n88991zUf6GE0qlTJ3777bfs7W7dutGvX78/tBszZgwNGjRg2LBhXHbZZXTu3JnSpUv/od3999+f/fiqq66iZ8+efPfddwwaNIiMjIzs17788kumTJnCWWedxcqVK1m/fj01atSgdevWLFiwgBYtWkTl/FKv579nD/TsCaVLu9r7jz9uid+E9fvvv/P3v/+dli1b0r17dw4ePMj+/ftp164dF154Id26dWPEiBHZ7dPT07Mf79+/n/bt25OWlsbll1/O4cOHGTJkCCNHjmTkyJG0bt36mGPlfO+BAwfo2rUrzZs3p3379uzbty9knKpKRkYGRYsWZdu2bbRr146mTZtm9zK3bdtGWloajRo1okePHkycOJENGzbQvXt3+vTpQ58+fbLb5X7v9u3bueiii2jevDnXX3990OcANmzYQO/evbO3f/31Vzp06ECLFi2y/7Lp3bs3DzzwAC1atKBp06bs378/5Lnt37+fsmXLArB582aaN29OixYtuNtbFzvS8wj03kBmzpzJ3Llzs78CJX6AuXPncvXVVwOQlpbG4sWLQ57HF198wemnn06VKlUoXbo0r7322jGvX3XVVVStWpV33nmHnTt38uc//xmAxo0bs2zZspD7zhNVTfivBg0aaJarn/lUr37mU82TzEzV995TPXzYbS9frnrgQN72YeJmzZo1vh5/6NCh+vzzzx/z3JgxY3T48OHZr48bN06XLl2qffv21YMHD+oFF1xwTPuWLVtmP168eLF26NBBVVVnzpypO3fuVFXVKVOm6JQpU/5w/JzvffLJJ3XEiBGqqjp58mT97LPPAsbcq1cvrVevnp555pl64403amZmpt5yyy3Z+2/UqJH+/PPP+vrrr+vw4cN106ZN2r59e1VVXb9+vZYuXVoXLlyYvb9A750+fboOGDBAVVWnTZumR44cCfhc1j579eqVvb/bb79dp02bpqqqvXv31vfee0979eqlgwYNUlXVPn366IIFCwKeW85zzPL555/rvHnzdM+ePVqnTp08nUeg9x6PVq1a6a5du1RVdfz48frSSy+FbN+9e3ddt27dMc/l/J6rqu7cuVN79uypffr0yf5M165dqyNHjgy630A/N8BiDZJXk6bn/+JnG+kyfiFrtuRxCGDLFrd+brt2Rwux1a3r7to1JkJr1qzhwgsvBFwPbO3atVSpUoUlS5aQlpbGLbfcEvS9559/Pueeey5t27Zl1qxZlChRIuLjfvXVVzRq1AhwPeULLrggaNsxY8Zwww03cNZZZyEifP3114wbN4709HT27t3L5s2bqV69OtOnT6dLly7HxNy2bdtjxtIDvbddu3YcOXKENm3a8NVXX3HCCScEfC7c53fhhReydu1aAHr16gXAmWeeycGDB0N+FpmZmbh8BoULF2bkyJH07ds3+6JopOcR7L25derUKXuMPj09nQkTJgRsV6pUqey/WjIyMkKOy+/atYvt27dz1llnhTzXcuXKMXXqVA4dOsQXX3wBwPr16znjjDNCvi8vkib557mmjypMngw1a8L778Ojj1ohNpNvtWvXZtGiRQAsWrSI2rVr8/7773PvvfeycOFCunfvHvS9K1asoFmzZsyePZudO3cyb948AIoXL549jJOV1HI755xzsn/4R4wYwcSJE0PGef311zNp0iSOHDlCjRo1GDlyJHPnzmXw4MGcdNJJzJw5k8mTJzN//nwuvvji7PeVKlXqmP0Eeu/ChQvp0aMHH3zwAXPmzOG7774L+Fyknx9AyTwMuV5wwQXZM15Gjx7NkCFDmDhx4jE3OEVyHsHem1ukwz4NGjRg/vz5gPteV6tWLeQ+L7vsspDnecMNN2Sf565duyhXrhwAM2bMoG3btiHfmxdJkfy/37E3O/G/fH0Tul14Zvg39e8P117revlffgmDBtlMHhOx++67j4YNG9KwYUPGjh1L3759Wb16NWlpaXz77bfZs2sGDBhAq1at6Nq1K6tWrQq4r2rVqvHUU0/RtGlTtm7dSsOGDQFo06YNr7/+Os2aNcv+hZDbddddx9KlS0lPT2fp0qX06NEjZNzly5enVatWvPbaawwePJjHHnuMZs2a8f7771OxYkUaNGjAlVdeSevWrenZs2fQOfOB3lu9enXuvPNOmjRpwqmnnkrVqlUDPhfIkCFD+N///kfz5s0pV65cvpJY3759efLJJ9m3bx/t27enf//+dOzYkRIlSuTpPCJ9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g7vDcBswBquB+6bQDOnix9AGeBQaqanfvfUOAl1W1KfA3ETk5xDFMAReLNXyNyY+HVHVaju1DQF9cDZeTCF7CeSmwSkRm45L1+0ANoKmIpAPlcMnxy0iOKyK1gNe9zUW4hDo+wDHyTVW/EZHTRaQMsEtV94pIXmIegLvV/3dVVRE5jKt9k4G7EziYGkATEemNKxRWGVct06Qg6/mbRHUtMB34O66EczB1gQXq1jgoD7QAvgaeUNV04B5gYx6Ouxr3VwDev6uDHCOY/UAJyB6aCeZzYCDwpred15jHA9d6tW5uAx7G/bLMeddm7li+BgZ7xxhJAaqMafLOkr9JVB/ghinmeNtVgrTbANwsIp8ClYDFuLr37bzhnP7krfb7RKC2996zcUMngY4RKu4rRGQBoX9JvIpL/m9723mKWVV34j6bK719PIP7RbJPRLI+q9dw1x8WAWfhEv4dXmyX4oaNTIqy8g7GGJOCrOdvjDEpyJK/McakIEv+xhiTgiz5G2NMCrLkb4wxKciSvzHGpKD/ByHhxoSGlod5AAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "#绘制ROC曲线\n",
    "from sklearn.metrics import roc_auc_score\n",
    "from sklearn.metrics import roc_curve\n",
    " \n",
    "logrocauc = roc_auc_score(y_test, logregression.predict(X_test))\n",
    "fpr, tpr, thresholds = roc_curve(y_test, logregression.predict_proba(X_test)[:,1])\n",
    "plt.figure()\n",
    "plt.plot(fpr, tpr, label='Logistic Regression (area = %0.3f)' % logrocauc)\n",
    "plt.plot([0, 1], [0, 1],'r--')\n",
    "plt.xlim([0.0, 1.05])\n",
    "plt.ylim([0.0, 1.05])\n",
    "plt.xlabel('False Positive Rate')\n",
    "plt.ylabel('True Positive Rate')\n",
    "plt.title('Receiver operating characteristic')\n",
    "plt.legend(loc=\"lower right\")\n",
    "#plt.savefig('Log_ROC')\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "4090becb",
   "metadata": {},
   "source": [
    "ROC曲线，全称为Receiver Operating Characteristic curve，中文名“受试者工作特征曲线”，是一种常用于评估分类器性能的图形工具。该曲线在一个二维平面上绘制，横坐标为假正率（False Positive Rate, FPR），纵坐标为真正率（True Positive Rate, TPR）。\n",
    "\n",
    "在具体应用中，我们通常会根据分类器在测试样本上的表现得到一个TPR和FPR点对，这个点对就可以映射到ROC平面上的一点。然后通过调整分类器在分类时的阈值，我们就可以得到一条经过原点(0,0)且斜率为1的曲线，这条曲线就被称为此分类器的ROC曲线。一般情况下，我们希望ROC曲线能够尽量地远离对角线，即位于 (0, 0)和 (1, 1)连线的上方，因为这意味着模型的分类效果越好。\n",
    "\n",
    "此外，ROC曲线不仅可以帮助我们评价某个或多个指标对两类被试（如病人和健康人）分类/诊断的效果，还可以找到最佳的指标临界值使得分类效果最好。同时，我们还可以通过计算ROC曲线下的面积（AUC, Area under Curve），这个值介于0.1和1之间，作为一个数值来直观的评价分类器的好坏，AUC的值越大，说明分类器的性能越好。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "9c290bb8",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "id": "9cfdd01d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.7125580995007746"
      ]
     },
     "execution_count": 32,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "logrocauc"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "id": "75115f93",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([0.        , 0.        , 0.        , 0.00636943, 0.00636943,\n",
       "       0.01273885, 0.01273885, 0.01910828, 0.01910828, 0.02547771,\n",
       "       0.02547771, 0.03184713, 0.03184713, 0.04458599, 0.04458599,\n",
       "       0.07006369, 0.07006369, 0.07643312, 0.07643312, 0.08280255,\n",
       "       0.08280255, 0.10191083, 0.10191083, 0.12101911, 0.12101911,\n",
       "       0.13375796, 0.13375796, 0.1656051 , 0.1656051 , 0.18471338,\n",
       "       0.18471338, 0.19745223, 0.19745223, 0.20382166, 0.20382166,\n",
       "       0.22292994, 0.22292994, 0.24203822, 0.24203822, 0.26751592,\n",
       "       0.26751592, 0.2866242 , 0.2866242 , 0.29299363, 0.29299363,\n",
       "       0.29936306, 0.29936306, 0.31210191, 0.31210191, 0.33121019,\n",
       "       0.33121019, 0.33757962, 0.33757962, 0.35031847, 0.35031847,\n",
       "       0.3566879 , 0.3566879 , 0.36942675, 0.36942675, 0.41401274,\n",
       "       0.41401274, 0.44585987, 0.44585987, 0.50318471, 0.50318471,\n",
       "       0.52866242, 0.52866242, 0.59235669, 0.59235669, 0.6433121 ,\n",
       "       0.6433121 , 0.89171975, 0.89171975, 1.        ])"
      ]
     },
     "execution_count": 33,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "fpr"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "id": "a7631601",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([0.        , 0.01351351, 0.04054054, 0.04054054, 0.05405405,\n",
       "       0.05405405, 0.10810811, 0.10810811, 0.27027027, 0.27027027,\n",
       "       0.2972973 , 0.2972973 , 0.32432432, 0.32432432, 0.44594595,\n",
       "       0.44594595, 0.48648649, 0.48648649, 0.51351351, 0.51351351,\n",
       "       0.52702703, 0.52702703, 0.55405405, 0.55405405, 0.56756757,\n",
       "       0.56756757, 0.58108108, 0.58108108, 0.63513514, 0.63513514,\n",
       "       0.64864865, 0.64864865, 0.66216216, 0.66216216, 0.67567568,\n",
       "       0.67567568, 0.7027027 , 0.7027027 , 0.72972973, 0.72972973,\n",
       "       0.74324324, 0.74324324, 0.75675676, 0.75675676, 0.77027027,\n",
       "       0.77027027, 0.78378378, 0.78378378, 0.7972973 , 0.7972973 ,\n",
       "       0.83783784, 0.83783784, 0.85135135, 0.85135135, 0.86486486,\n",
       "       0.86486486, 0.87837838, 0.87837838, 0.90540541, 0.90540541,\n",
       "       0.91891892, 0.91891892, 0.93243243, 0.93243243, 0.94594595,\n",
       "       0.94594595, 0.95945946, 0.95945946, 0.97297297, 0.97297297,\n",
       "       0.98648649, 0.98648649, 1.        , 1.        ])"
      ]
     },
     "execution_count": 34,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "tpr"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "2a4cde98",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.7"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
